﻿function slideAddParagraphBox() {
    $('.add-paragraph').slideToggle("slow");
}

function onAddingParagraph(panelToBeRefreshedId) {
    $(panelToBeRefreshedId).children('.add-paragraph').children('.loading').show();
    $(panelToBeRefreshedId).children('.add-paragraph').children('div').children("input[type='text']").attr('disabled', 'disabled');
    $(panelToBeRefreshedId).children('.add-paragraph').children('div').children('textarea').attr('disabled', 'disabled');
    $(panelToBeRefreshedId).children('.add-paragraph').children("input[type='submit']").attr('disabled', 'disabled');
}

function onAddedParagraph(panelToBeRefreshedId) {
    $(panelToBeRefreshedId).children('.add-paragraph').children('.loading').hide();
    $(panelToBeRefreshedId).children('.add-paragraph').children('div').children("input[type='text']").removeAttr('disabled');
    $(panelToBeRefreshedId).children('.add-paragraph').children('div').children('textarea').removeAttr('disabled');
    $(panelToBeRefreshedId).children('.add-paragraph').children("input[type='submit']").removeAttr('disabled');

    $(panelToBeRefreshedId).children('.add-paragraph').children('div').children("input[type='text']").val('');
    $(panelToBeRefreshedId).children('.add-paragraph').children('div').children('textarea').val('');
}


$(function () {
    $(document).ready(function () {
        $('.new-paragraph-butt').bind('click', slideAddParagraphBox);
    });
    $('.new-paragraph-butt').mouseover(function () {
        $(this).css({
            "background-color": "white",
            "color": "black"
        });
    });
    $('.new-paragraph-butt').mouseout(function () {
        $(this).css({
            "background-color": "#D9D9D7",
            "color": "black"
        });
    });
});